package cn.edu.zut.curriculum.service.impl;

import cn.edu.zut.curriculum.entity.Order;
import cn.edu.zut.curriculum.mapper.OrderMapper;
import cn.edu.zut.curriculum.service.IOrderSerivice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Orderserviceimpl implements IOrderSerivice {
    @Autowired
    OrderMapper orderMapper;

    @Override
    public Order insert(Order order){

        if(orderMapper.save(order)==1){
            order.setMessage("下单成功");
            return order;
        }
        else {
            order.setMessage("未知错误，可能已售出");
            return order;
        }
    }
    @Override
    public List<Order> select(long uid){
        List<Order>list=orderMapper.selectOrder(uid);
        return list;
    }
}
